
#ifndef __CFashionMgr_h__
#define __CFashionMgr_h__

#include "commerrno.h"
#include "CFashionCfg.h"

class CPlayerBaseInfo;
class MsgAnsFashionOpt;
class CPlayerOnlineData;
class MsgFashionAttr;

class CFashionMgr
{
public:
    enum ENM_CMD_FASHION_SUB_TAG
    {
        CMD_FASHION_SUB_GET_INFO = 1, //获取信息
        CMD_FASHION_SUB_WARE = 2, //穿时装
        CMD_FASHION_SUB_SHOW_WING = 3, //显示翅膀
        CMD_FASHION_SUB_EXTEND = 4, //时装续费
        CMD_FASHION_SUB_TAKE_OFF = 5, //脱时装
        CMD_FASHION_SUB_HIDE_WING = 6, //隐藏翅膀
        CMD_FASHION_SUB_SHOW_DRESS = 7, //显示装扮
        CMD_FASHION_SUB_HIDE_DRESS = 8, //隐藏装扮
    };

    enum ENM_FASHION_MACRO_TAG
    {
        ENM_FASHION_MACRO_MASTER_LVL = 2, //达到此等级下发全服TIP
    };

    CFashionMgr()
    {
    }

    virtual ~CFashionMgr()
    {
    }

    int LoadConfig(const char* szCfgPath);
    
    int InitData(CUserFashion& stUserFashion,
            CPlayerOnlineData& stPlayerOnlineData);

    int OpenFashionInBag(CPlayerBaseInfo& stPlayerBaseInfo,
            CUserFashion& stUserFashion,
            CPlayerOnlineData& stPlayerOnlineData,
            const CStorageGrid& stGrid);

    void GetFashionInfo(CUserFashion& stUserFashion,
            CPlayerOnlineData& stPlayerOnlineData, MsgAnsFashionOpt& stAns);

    int GetFashionMasterAddtion(CUserFashion& stUserFashion);

    int GetFashionMasterLevel(CUserFashion& stUserFashion);

	void GetFashionExtAttr(CUserFashion& stUserFashion,
        CPlayerOnlineData& stPlayerOnlineData, MsgFashionAttr& stFashionAttr);
    int GetFashionAttr(CUserFashion& stUserFashion, CPlayerAttr& stAttr);

    int GetFashionWingAttr(CUserFashion& stUserFashion, CPlayerAttr& stAttr);
    
	int GetFashionDressAttr(CUserFashion& stUserFashion, CPlayerAttr& stAttr);
    
	int UseFashion(CUserFashion& stUserFashion,
            CPlayerOnlineData& stPlayerOnlineData, unsigned short usFashionID);

    int HiddenFashion(CUserFashion& stUserFashion,
            CPlayerOnlineData& stPlayerOnlineData,unsigned char ucOpt);

    int ExtendValidity(CPlayerBaseInfo& stPlayerBaseInfo,
            CPlayerOnlineData& stPlayerOnline, CUserFashion& stUserFashion,
            unsigned short usFashionID, int& iFasionPos);

    int UnWareFashion(CUserFashion& stUserFashion, unsigned short usFashionID);

    void SendWingBagInfoToFront(CUserFashion& stUserFashion, unsigned int uiGID,
            PBMsgHead stMsgHead, CTLib::CEnpNetHead& stEnpHead);

    void SendDressBagInfoToFront(CUserFashion& stUserFashion,
            unsigned int uiGID, PBMsgHead stMsgHead,
            CTLib::CEnpNetHead& stEnpHead);

    bool HasThisFashion(unsigned short usFashionID);

private:
    CFashionCfg _stFashionCfg;
};

#endif //__CFashionMgr_h__

